<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3" xmlns:head="http://www.w3.org/1999/html">
<head th:include="public/public_css::public_css ('收货日报')"/>

<body style="background-color: #f2f2f2;">
<div class="layui-fluid larry-wrapper">
    <div class="layui-card">
        <div class="layui-row layui-col-space30">
            <div class="layui-col-xs24">
                <form class="layui-form layui-card-header  layui-card-header-auto" id="searchForm">
                    <div class="layui-inline">
                        <label class="layui-form-label">供应商</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="gysmc" name="gysmc" placeholder="供应商名称"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">入库时间</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" name="stime" id="stime"
                                   placeholder="yyyy-MM-dd HH:mm:ss"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">ASN编码</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="asnbh" name="asnbh" placeholder="ASN编码"/>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">货品编号</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="hpbh" name="hpbh" placeholder="货品编号"/>
                        </div>
                    </div>


                    <div class="layui-inline inline-search-btn">
                        <a class="layui-btn layui-btn-normal search_btn" lay-event="searchEvent"
                           data-type="reload">查询</a>
                    </div>
                    <div class="layui-inline inline-reset-btn">
                        <button type="reset" class="layui-btn layui-btn-normal">重置
                        </button>
                    </div>
                    <div class="moreSearch" style="display: none">
                        <div class="layui-inline">
                            <label class="layui-form-label">货品名称</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="hpmc" name="hpmc" placeholder="货品名称"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">库位名称</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="kwmc" name="kwmc" placeholder="库位名称"/>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">收货数量</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" id="sl" name="sl" placeholder="收货数量"/>
                            </div>
                        </div>
                    </div>
                </form>
                <div class="moreBtn"><i class="layui-icon layui-icon-triangle-d" style="color: #1E9FFF;"></i></div>
                <div class="group-button tpl-button" id="toolbar">

                    <a class="layui-btn layui-btn-sm layui-btn-normal out-put">
                        <i class="layui-icon">&#x1005;</i> 导出
                    </a>
                </div>
                <!--列表-->
                <section class="panel panel-padding layui-card-body">
                    <div class="pro">
                        <table id="table" class="table text-nowrap"></table>
                    </div>
                </section>
            </div>
        </div>
    </div>
</div>

</body>


<div th:include="public/public_js::public_js"></div>
<div th:include="public/public_btn::public_btn"></div>
<style type="text/css">
    .moreBtn {
        width: 50px;
        height: 20px;
        text-align: center;
        color: #fff;
        line-height: 20px;
        background-color: #eee;
        position: relative;
        margin: 0 auto;
        cursor: pointer;
    }

    .moreBtn:before {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(30deg);
        background: #eee;
        border-top-left-radius: 8px;
        left: -20px;
        top: 0;
    }

    .moreBtn:after {
        content: '';
        display: block;
        width: 35px;
        height: 20px;
        position: absolute;
        transform: skewX(-30deg);
        background: #eee;
        border-top-right-radius: 8px;
        top: 0;
        right: -20px;
    }
</style>
<script th:inline="javascript">
    $(function () {
        $(".moreBtn").on("click", function () {
            $(".moreSearch").toggle();
        });
    });
    var functions = [[${functions}]];
    layui.use(['list', 'layer', 'zzpUtils', 'jquery', 'laydate', 'tablebutton'], function () {
        window.operateEvent = {
            "click .layui-btn-primary": function (e, value, row, index) {
                /*这里激活状态那个按钮用不到，啥都不需要写，只读*/
            }
        }

        var zzpUtils = layui.zzpUtils,
            $ = layui.jquery,
            laydate = layui.laydate,
            tablebtn = layui.tablebutton;
        tablebtn.buildOnClick({
            type: 1,
            temp: $("#function_tpl"),
            functions: functions.headBtn,
            row: null,
            event: {
                searchEvent: function () {
                    zzpUtils.refreshTable("#table");
                },
                //导出
                exportEvent: function (data) {
                    var arr = [];
                    var $rows = $table.bootstrapTable('getSelections');
                    if ($rows.length > 0) {
                        arr = $.map($rows, function (row) {
                            return row.id;
                        })
                    }
                    /*
                     * 以下是将ids和对象拼接在一起
                     * */
                    var str = zzpUtils.getFormJson($("#searchForm"));
                    var object2 = Object.assign({ids: arr}, str);
                    /*将条件查询和ids传到后台*/
                    zzpUtils.outputXslx({
                        url: "/reports/getOutPutHarvest",
                        data: JSON.stringify(object2)
                    });
                }
            }
        });

        laydate.render({
            elem: '#stime'
            , theme: '#20a0ff'
            , range: '~'//练起来
        })

        var $table = zzpUtils.table({
            elem: '#table',
            isApi: true,
            pagination: true,
            url: '/reports/baseHarvestPage',
            columns: [{
                field: '',
                checkbox: true
            }, {
                field: 'czsj',
                title: '入库时间',
                formatter: function (value, row, index) {
                    if (value != null) {
                        return value.substr(0,19);
                    }
                }

            }, {
                field: 'asnbh',
                title: 'ASN编码'
            }, {
                field: 'hpbh',
                title: '货品编号'
            }, {
                field: 'hpmc',
                title: '货品名称'
            }, {
                field: 'gysmc',
                title: '供应商名称',
                width: 150
            }, {
                field: 'yqsl',
                title: '预期数量'
            }, {
                field: 'sl',
                title: '收货数量'
            }, {
                field: 'hppc',
                title: '货品批次'
            }, {
                field: 'kwmc',
                title: '库位名称'
            }, {
                field: 'show_asnzt',
                title: 'ASN状态'
            }, {
                field: 'scrq',
                title: '生产日期',
                formatter: function (value, row, index) {
                    if (value != null) {
                        return value.substr(0,19);
                    }
                }
            }, {
                field: 'ms',
                title: '包装描述'
            }
            ],
            queryParams: function () {//查询条件
                return zzpUtils.getFormJson($("#searchForm"));
            },
            detailFormatter: function (index, row) {
                return "这里就没有确定过11";
            }
        });

        //查询
        /*   $(".inline-search-btn").on('click', function () {
               zzpUtils.refreshTable("#table");
           })
   */

    });

</script>
</html>